# delete_folder.py

import os

def delete_folder(folder_path):
    try:
        for filename in os.listdir(folder_path):
            file_path = os.path.join(folder_path, filename)
            if os.path.isfile(file_path) or os.path.islink(file_path):
                os.unlink(file_path)
            elif os.path.isdir(file_path):
                os.rmdir(file_path)
        os.rmdir(folder_path)
        print(f"文件夹 {folder_path} 已成功删除")
    except Exception as e:
        print(f"删除文件夹 {folder_path} 时出错: {e}")

if __name__ == "__main__":
    delete_folder("output")